#!/usr/bin/env coffee

import {randomBytes} from 'crypto'
import {join} from 'path'
import ENV from '@rmw/env'
import {readFileSync,writeFileSync,existsSync} from 'fs'

_seed = undefined
export default =>
  if not _seed
    seed_path = join(ENV.config,'seed')

    if existsSync(seed_path)
      _seed = readFileSync(seed_path)
    else
      _seed = randomBytes 32
      writeFileSync seed_path,_seed
  _seed
